USE [master]
GO
/****** Object:  Database [GN4.Pay]    Script Date: 2017/6/21 11:19:52 ******/
CREATE DATABASE [GN4.Pay]
 CONTAINMENT = NONE
 ON  PRIMARY 
( NAME = N'GNPay', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\GN4.Pay.mdf' , SIZE = 18432KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'GNPay_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\GN4.Pay_log.ldf' , SIZE = 494848KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [GN4.Pay] SET COMPATIBILITY_LEVEL = 110
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [GN4.Pay].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [GN4.Pay] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [GN4.Pay] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [GN4.Pay] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [GN4.Pay] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [GN4.Pay] SET ARITHABORT OFF 
GO
ALTER DATABASE [GN4.Pay] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [GN4.Pay] SET AUTO_CREATE_STATISTICS ON 
GO
ALTER DATABASE [GN4.Pay] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [GN4.Pay] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [GN4.Pay] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [GN4.Pay] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [GN4.Pay] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [GN4.Pay] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [GN4.Pay] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [GN4.Pay] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [GN4.Pay] SET  DISABLE_BROKER 
GO
ALTER DATABASE [GN4.Pay] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [GN4.Pay] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [GN4.Pay] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [GN4.Pay] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [GN4.Pay] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [GN4.Pay] SET READ_COMMITTED_SNAPSHOT OFF 
GO
ALTER DATABASE [GN4.Pay] SET HONOR_BROKER_PRIORITY OFF 
GO
ALTER DATABASE [GN4.Pay] SET RECOVERY FULL 
GO
ALTER DATABASE [GN4.Pay] SET  MULTI_USER 
GO
ALTER DATABASE [GN4.Pay] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [GN4.Pay] SET DB_CHAINING OFF 
GO
ALTER DATABASE [GN4.Pay] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
GO
ALTER DATABASE [GN4.Pay] SET TARGET_RECOVERY_TIME = 0 SECONDS 
GO
EXEC sys.sp_db_vardecimal_storage_format N'GN4.Pay', N'ON'
GO
USE [GN4.Pay]
GO
/****** Object:  Table [dbo].[Bank_Info]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Bank_Info](
	[Id] [varchar](20) NOT NULL,
	[BankName] [nvarchar](100) NOT NULL,
	[LogoUrl] [nvarchar](255) NULL,
 CONSTRAINT [PK_Bank_Info] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Merchant_AppChannel]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Merchant_AppChannel](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[AppId] [varchar](32) NOT NULL,
	[ChannelId] [varchar](32) NOT NULL,
	[ChannelName] [nvarchar](50) NOT NULL,
	[ChannelType] [int] NOT NULL,
	[ConfigureData] [nvarchar](max) NOT NULL,
	[CreationTime] [datetime] NOT NULL,
	[LastModificationTime] [datetime] NULL,
	[State] [int] NULL,
 CONSTRAINT [PK_Merchant_AppChannel] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Merchant_AppInfo]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Merchant_AppInfo](
	[Id] [varchar](32) NOT NULL,
	[MerchantId] [varchar](32) NOT NULL,
	[AppName] [nvarchar](50) NOT NULL,
	[AppKey] [nvarchar](max) NOT NULL,
	[AppHomeUrl] [nvarchar](255) NOT NULL,
	[PayDefaultNotifyUrl] [nvarchar](255) NULL,
	[PayDefaultReturnUrl] [nvarchar](255) NULL,
	[RefundDefaultNotifyUrl] [nvarchar](255) NULL,
	[PublicKey] [nvarchar](max) NOT NULL,
	[PrivateKey] [nvarchar](max) NOT NULL,
	[SignKey] [nvarchar](max) NOT NULL,
	[State] [int] NOT NULL,
 CONSTRAINT [PK_Merchant_AppInfo] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Merchant_AppSmsTemplate]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Merchant_AppSmsTemplate](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[AppId] [varchar](32) NOT NULL,
	[SmsType] [int] NOT NULL,
	[SmsTemplate] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_Merchant_AppSmsTemplate] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Merchant_Info]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Merchant_Info](
	[Id] [varchar](32) NOT NULL,
	[MerchantName] [nvarchar](50) NOT NULL,
	[MerchantType] [int] NOT NULL,
	[CashierName] [nvarchar](20) NOT NULL,
	[LogoUrl] [nvarchar](255) NULL,
	[State] [int] NOT NULL,
 CONSTRAINT [PK_Merchant_Info] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Merchant_Member]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Merchant_Member](
	[Id] [varchar](32) NOT NULL,
	[MerchantId] [varchar](32) NOT NULL,
	[MemberNo] [varchar](64) NOT NULL,
	[MemberName] [varchar](100) NULL,
	[MemberRealName] [varchar](100) NULL,
	[MemberType] [int] NULL,
	[IsCertification] [bit] NOT NULL,
 CONSTRAINT [PK_Merchant_Member] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Merchant_MemberBankCard]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Merchant_MemberBankCard](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[MemberId] [varchar](32) NOT NULL,
	[BankNo] [varchar](20) NOT NULL,
	[ChannelId] [varchar](32) NOT NULL,
	[AccountNo] [varchar](50) NOT NULL,
	[AccountName] [varchar](50) NOT NULL,
	[IdentityNo] [varchar](30) NOT NULL,
	[AccountType] [int] NOT NULL,
	[OpenBankName] [varchar](50) NULL,
	[OpenBankProvince] [varchar](50) NULL,
	[OpenBankCity] [varchar](20) NULL,
	[MobilePhone] [varchar](20) NOT NULL,
	[CreditCardLastTerm] [varchar](20) NULL,
	[CreditCardLastNo] [varchar](20) NULL,
	[ProtocolNo] [varchar](100) NULL,
	[ChannelMemberNo] [varchar](64) NULL,
	[State] [int] NOT NULL,
	[OperationTime] [datetime] NOT NULL,
 CONSTRAINT [PK_Merchant_MemberBankCard] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Queue_ErrorMessage]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Queue_ErrorMessage](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[MessageKey] [varchar](64) NOT NULL,
	[MessageType] [int] NOT NULL,
	[MessageContent] [nvarchar](max) NOT NULL,
	[Created] [datetime] NOT NULL,
 CONSTRAINT [PK_Queue_ErrorMessage] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[System_Configure]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[System_Configure](
	[Id] [varchar](50) NOT NULL,
	[ConfigureData] [nvarchar](max) NOT NULL,
	[IsEnable] [bit] NOT NULL,
	[OperatorTime] [datetime] NOT NULL,
 CONSTRAINT [PK_SYSTEM_CONFIGURE] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[System_Constant]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[System_Constant](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[GroupId] [int] NOT NULL,
	[ConstantId] [int] NOT NULL,
	[ConstantName] [nvarchar](100) NOT NULL,
	[ConstantExplain] [nvarchar](255) NULL,
	[IntegerProperty1] [bigint] NULL,
	[IntegerProperty2] [bigint] NULL,
	[IntegerProperty3] [bigint] NULL,
	[StringProperty1] [nvarchar](100) NULL,
	[StringProperty2] [nvarchar](100) NULL,
	[StringProperty3] [nvarchar](100) NULL,
	[DecimalProperty1] [decimal](38, 4) NULL,
	[DecimalProperty2] [decimal](38, 4) NULL,
	[DecimalProperty3] [decimal](38, 4) NULL,
 CONSTRAINT [PK_SYSTEM_CONSTANT] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[System_ConstantGroup]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[System_ConstantGroup](
	[Id] [int] NOT NULL,
	[GroupName] [nvarchar](20) NOT NULL,
	[GroupExplain] [nvarchar](300) NULL,
 CONSTRAINT [PK_SYSTEM_CONSTANTGROUP] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Trade_AccountBook]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_AccountBook](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[ApplyId] [varchar](36) NULL,
	[AppId] [varchar](36) NOT NULL,
	[OrderNo] [varchar](32) NOT NULL,
	[OrderTime] [datetime] NOT NULL,
	[OrderMoney] [decimal](29, 2) NOT NULL,
	[MemberNo] [varchar](64) NULL,
	[Subject] [nvarchar](max) NULL,
	[Body] [nvarchar](max) NULL,
	[Remark] [nvarchar](max) NULL,
	[AppIP] [varchar](255) NOT NULL,
	[FirstChannelId] [varchar](20) NOT NULL,
	[PayTime] [datetime] NOT NULL,
	[PayCount] [int] NOT NULL,
	[PayFee] [decimal](29, 2) NOT NULL,
	[PayMoney] [decimal](29, 2) NOT NULL,
	[RefundMoney] [decimal](29, 2) NOT NULL,
	[RefundFee] [decimal](29, 2) NOT NULL,
	[BookTime] [datetime] NOT NULL,
	[TradeState] [int] NOT NULL,
	[TradeBalanceMoney] [decimal](29, 2) NOT NULL,
	[BookBalanceMoney] [decimal](29, 2) NOT NULL,
 CONSTRAINT [PK_TRADE_ACCOUNTBOOK] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_AccountBook_Channel]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_AccountBook_Channel](
	[Id] [varchar](64) NOT NULL,
	[BookId] [bigint] NOT NULL,
	[ChannelId] [varchar](32) NOT NULL,
	[ApplyTime] [datetime] NOT NULL,
	[PayTime] [datetime] NOT NULL,
	[PayFee] [decimal](29, 2) NOT NULL,
	[PayMoney] [decimal](29, 2) NOT NULL,
	[RefundMoney] [decimal](29, 2) NOT NULL,
	[RefundFee] [decimal](29, 2) NOT NULL,
	[TradeBalanceMoney] [decimal](29, 2) NOT NULL,
	[BookBalanceMoney] [decimal](29, 2) NOT NULL,
	[ClientIP] [varchar](255) NOT NULL,
	[ChannelTradeNo] [varchar](100) NULL,
	[OtherPartyAccount] [varchar](100) NULL,
	[OtherPartyAccountId] [varchar](100) NULL,
	[BankType] [varchar](100) NULL,
	[BankName] [varchar](100) NULL,
	[BookTime] [datetime] NOT NULL,
 CONSTRAINT [PK_TRADE_ACCOUNTBOOK_CHANNEL] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_Channel]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_Channel](
	[Id] [varchar](32) NOT NULL,
	[ChannelName] [nvarchar](50) NOT NULL,
	[ChannelType] [int] NOT NULL,
	[ChannelProvider] [nvarchar](100) NOT NULL,
	[State] [int] NOT NULL,
 CONSTRAINT [PK_Trade_Channel] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_Notify]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_Notify](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[AppId] [varchar](32) NOT NULL,
	[TradeNo] [varchar](64) NOT NULL,
	[NotifyType] [int] NOT NULL,
	[NotifyUrl] [varchar](255) NOT NULL,
	[ReturnUrl] [varchar](255) NULL,
	[UrlParms] [nvarchar](max) NOT NULL,
	[Sign] [nvarchar](36) NOT NULL,
	[Count] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[CreationTime] [datetime] NOT NULL,
	[LastNotifyTime] [datetime] NULL,
	[NotifyMsg] [nvarchar](max) NULL,
 CONSTRAINT [PK_TRADE_NOTIFY] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_PayApply]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_PayApply](
	[Id] [varchar](36) NOT NULL,
	[AppId] [varchar](36) NOT NULL,
	[OrderNo] [varchar](32) NOT NULL,
	[OrderTime] [datetime] NOT NULL,
	[OrderMoney] [decimal](29, 2) NOT NULL,
	[MemberNo] [varchar](64) NULL,
	[UserToken] [varchar](255) NULL,
	[Subject] [nvarchar](255) NOT NULL,
	[Body] [nvarchar](1000) NULL,
	[Remark] [nvarchar](max) NULL,
	[AppIP] [varchar](255) NOT NULL,
	[ExpireMinute] [int] NOT NULL,
	[NotifyUrl] [varchar](255) NULL,
	[ReturnUrl] [varchar](255) NULL,
	[ExtraParam] [nvarchar](max) NULL,
	[ApplyPlatformCount] [int] NOT NULL,
	[ApplyTime] [datetime] NOT NULL,
	[ShowUrl] [varchar](255) NULL,
 CONSTRAINT [PK_TRADE_PAYAPPLY] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_PayApply_Channel]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_PayApply_Channel](
	[Id] [varchar](64) NOT NULL,
	[ApplyId] [varchar](36) NOT NULL,
	[ChannelId] [varchar](32) NOT NULL,
	[ClientIP] [varchar](255) NOT NULL,
	[CallType] [int] NULL,
	[PayId] [varchar](100) NULL,
	[PayUrl] [nvarchar](255) NULL,
	[PayParams] [nvarchar](max) NULL,
 CONSTRAINT [PK_TRADE_PAYAPPLY_CHANNEL] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_RefundApply]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_RefundApply](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[AppId] [varchar](36) NOT NULL,
	[ApplyNo] [varchar](32) NOT NULL,
	[OrderNo] [varchar](32) NOT NULL,
	[TradeNo] [varchar](64) NOT NULL,
	[ChannelId] [varchar](20) NOT NULL,
	[ApplyMoney] [decimal](29, 2) NOT NULL,
	[MemberNo] [varchar](64) NULL,
	[AppIP] [varchar](255) NOT NULL,
	[NotifyUrl] [varchar](255) NULL,
	[ExtraParam] [nvarchar](max) NULL,
	[Reason] [varchar](255) NULL,
	[RefundTradeNo] [varchar](64) NULL,
	[ApplyTime] [datetime] NOT NULL,
	[ApplyState] [int] NOT NULL,
	[ApplyStateMessage] [nvarchar](max) NOT NULL,
	[LastSubmitTime] [datetime] NULL,
 CONSTRAINT [PK_TRADE_REFUNDAPPLY] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_RefundBook]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_RefundBook](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[BookId] [bigint] NOT NULL,
	[ChannelId] [varchar](20) NOT NULL,
	[ApplyNo] [varchar](32) NOT NULL,
	[RefundTradeNo] [varchar](64) NULL,
	[OrderNo] [varchar](32) NOT NULL,
	[TradeNo] [varchar](64) NOT NULL,
	[ApplyMoney] [decimal](29, 2) NOT NULL,
	[RefundMoney] [decimal](29, 2) NOT NULL,
	[RefundFee] [decimal](29, 2) NOT NULL,
	[AppId] [varchar](36) NOT NULL,
	[AppIP] [varchar](255) NOT NULL,
	[Reason] [varchar](255) NULL,
	[ApplyTime] [datetime] NOT NULL,
	[RefundTime] [datetime] NOT NULL,
	[BookTime] [datetime] NOT NULL,
 CONSTRAINT [PK_Trade_RefundBook] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_TransfersApply]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_TransfersApply](
	[Id] [varchar](64) NOT NULL,
	[AppId] [varchar](32) NOT NULL,
	[ApplyNo] [varchar](32) NOT NULL,
	[ApplyTime] [datetime] NOT NULL,
	[AccountNo] [nvarchar](255) NOT NULL,
	[AccountName] [nvarchar](255) NOT NULL,
	[BankNo] [nvarchar](20) NULL,
	[OpenBankName] [nvarchar](255) NULL,
	[ProvinceCity] [nvarchar](50) NULL,
	[ChannelId] [varchar](20) NOT NULL,
	[ApplyMoney] [decimal](29, 2) NOT NULL,
	[Summary] [nvarchar](255) NOT NULL,
	[AppIp] [varchar](255) NOT NULL,
	[ClientIp] [varchar](255) NOT NULL,
	[NotifyUrl] [varchar](255) NULL,
	[ExtraParam] [nvarchar](max) NULL,
	[ApplyState] [int] NOT NULL,
	[LastSubmitTime] [datetime] NULL,
	[ApplyStateMessage] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_Trade_TransfersApply] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trade_TransfersBook]    Script Date: 2017/6/21 11:19:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trade_TransfersBook](
	[Id] [varchar](64) NOT NULL,
	[AppId] [varchar](32) NOT NULL,
	[ApplyNo] [varchar](32) NOT NULL,
	[ApplyTime] [datetime] NOT NULL,
	[BookTime] [datetime] NOT NULL,
	[ChannelTradeNo] [varchar](64) NOT NULL,
	[ApplyMoney] [decimal](29, 2) NOT NULL,
	[TransfersMoney] [decimal](29, 2) NOT NULL,
	[TransfersFee] [decimal](29, 2) NOT NULL,
	[TransfersTime] [datetime] NOT NULL,
	[AccountNo] [nvarchar](255) NOT NULL,
	[AccountName] [nvarchar](255) NOT NULL,
	[BankNo] [nvarchar](20) NULL,
	[OpenBankName] [nvarchar](255) NULL,
	[ProvinceCity] [nvarchar](50) NULL,
	[ChannelId] [varchar](20) NOT NULL,
	[Summary] [nvarchar](255) NOT NULL,
	[AppIp] [varchar](255) NOT NULL,
	[ClientIp] [varchar](255) NOT NULL,
 CONSTRAINT [PK_Trade_TransfersBook] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Bank_Info_Name]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Bank_Info_Name] ON [dbo].[Bank_Info]
(
	[BankName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_AppChannel_AppId]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Merchant_AppChannel_AppId] ON [dbo].[Merchant_AppChannel]
(
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_AppChannel_Channel]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Merchant_AppChannel_Channel] ON [dbo].[Merchant_AppChannel]
(
	[ChannelId] ASC,
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_AppInfo_Name]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Merchant_AppInfo_Name] ON [dbo].[Merchant_AppInfo]
(
	[MerchantId] ASC,
	[AppName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_AppSmsTemplate_Key]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Merchant_AppSmsTemplate_Key] ON [dbo].[Merchant_AppSmsTemplate]
(
	[AppId] ASC,
	[SmsType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_Info_Name]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Merchant_Info_Name] ON [dbo].[Merchant_Info]
(
	[MerchantName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_Member_Key]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Merchant_Member_Key] ON [dbo].[Merchant_Member]
(
	[MemberNo] ASC,
	[MerchantId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_MemberBankCard_AccountNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Merchant_MemberBankCard_AccountNo] ON [dbo].[Merchant_MemberBankCard]
(
	[AccountNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_MemberBankCard_BankNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Merchant_MemberBankCard_BankNo] ON [dbo].[Merchant_MemberBankCard]
(
	[BankNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_MemberBankCard_Key]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Merchant_MemberBankCard_Key] ON [dbo].[Merchant_MemberBankCard]
(
	[MemberId] ASC,
	[ChannelId] ASC,
	[AccountNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Merchant_MemberBankCard_MemberId]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Merchant_MemberBankCard_MemberId] ON [dbo].[Merchant_MemberBankCard]
(
	[MemberId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Queue_ErrorMessage]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Queue_ErrorMessage] ON [dbo].[Queue_ErrorMessage]
(
	[MessageKey] ASC,
	[MessageType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [Index_Key]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_Key] ON [dbo].[System_Constant]
(
	[GroupId] ASC,
	[ConstantId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_Apply]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_Apply] ON [dbo].[Trade_AccountBook]
(
	[ApplyId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_AppOrderNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [Index_AppOrderNo] ON [dbo].[Trade_AccountBook]
(
	[OrderNo] ASC,
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [Index_OrderTime]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_OrderTime] ON [dbo].[Trade_AccountBook]
(
	[OrderTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [Index_PayTime]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_PayTime] ON [dbo].[Trade_AccountBook]
(
	[PayTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_AccountBook_ChannelId]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_AccountBook_ChannelId] ON [dbo].[Trade_AccountBook]
(
	[FirstChannelId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_Channel]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [Index_Channel] ON [dbo].[Trade_AccountBook_Channel]
(
	[BookId] ASC,
	[ChannelId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_Channel_Name]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_Channel_Name] ON [dbo].[Trade_Channel]
(
	[ChannelName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_Notify_AppId]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_Notify_AppId] ON [dbo].[Trade_Notify]
(
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_Notify_TradeNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_Notify_TradeNo] ON [dbo].[Trade_Notify]
(
	[TradeNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_PayApply_App]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_PayApply_App] ON [dbo].[Trade_PayApply]
(
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_PayApply_Key]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Trade_PayApply_Key] ON [dbo].[Trade_PayApply]
(
	[OrderNo] ASC,
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_PayApply_Member]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_PayApply_Member] ON [dbo].[Trade_PayApply]
(
	[MemberNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_PayApply_Order]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_PayApply_Order] ON [dbo].[Trade_PayApply]
(
	[OrderNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_ApplyChannel]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [Index_ApplyChannel] ON [dbo].[Trade_PayApply_Channel]
(
	[ApplyId] ASC,
	[ChannelId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_ApplyKey]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_ApplyKey] ON [dbo].[Trade_RefundApply]
(
	[AppId] ASC,
	[ApplyNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_AppOrder]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_AppOrder] ON [dbo].[Trade_RefundApply]
(
	[OrderNo] ASC,
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_RefundTradeNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_RefundTradeNo] ON [dbo].[Trade_RefundApply]
(
	[RefundTradeNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_ApplyKey]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [Index_ApplyKey] ON [dbo].[Trade_RefundBook]
(
	[AppId] ASC,
	[ApplyNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_ApplyNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_ApplyNo] ON [dbo].[Trade_RefundBook]
(
	[ApplyNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_RefundTradeNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [Index_RefundTradeNo] ON [dbo].[Trade_RefundBook]
(
	[RefundTradeNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [Index_TradeNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [Index_TradeNo] ON [dbo].[Trade_RefundBook]
(
	[TradeNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_TransfersApply]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Trade_TransfersApply] ON [dbo].[Trade_TransfersApply]
(
	[AppId] ASC,
	[ApplyNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_TransfersApply_AppId]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_TransfersApply_AppId] ON [dbo].[Trade_TransfersApply]
(
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_TransfersApply_ApplyNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_TransfersApply_ApplyNo] ON [dbo].[Trade_TransfersApply]
(
	[ApplyNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [IX_Trade_TransfersApply_ApplyTime]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_TransfersApply_ApplyTime] ON [dbo].[Trade_TransfersApply]
(
	[ApplyTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_TransfersBook]    Script Date: 2017/6/21 11:19:53 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Trade_TransfersBook] ON [dbo].[Trade_TransfersBook]
(
	[AppId] ASC,
	[ApplyNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_TransfersBook_AppId]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_TransfersBook_AppId] ON [dbo].[Trade_TransfersBook]
(
	[AppId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_TransfersBook_ApplyNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_TransfersBook_ApplyNo] ON [dbo].[Trade_TransfersBook]
(
	[ApplyNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [IX_Trade_TransfersBook_ApplyTime]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_TransfersBook_ApplyTime] ON [dbo].[Trade_TransfersBook]
(
	[ApplyTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [IX_Trade_TransfersBook_BookTime]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_TransfersBook_BookTime] ON [dbo].[Trade_TransfersBook]
(
	[BookTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_Trade_TransfersBook_TradeNo]    Script Date: 2017/6/21 11:19:53 ******/
CREATE NONCLUSTERED INDEX [IX_Trade_TransfersBook_TradeNo] ON [dbo].[Trade_TransfersBook]
(
	[ChannelTradeNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Merchant_AppChannel]  WITH CHECK ADD  CONSTRAINT [FK_Merchant_AppChannel_Merchant_AppInfo] FOREIGN KEY([AppId])
REFERENCES [dbo].[Merchant_AppInfo] ([Id])
GO
ALTER TABLE [dbo].[Merchant_AppChannel] CHECK CONSTRAINT [FK_Merchant_AppChannel_Merchant_AppInfo]
GO
ALTER TABLE [dbo].[Merchant_AppInfo]  WITH CHECK ADD  CONSTRAINT [FK_Merchant_AppInfo_Merchant_Info] FOREIGN KEY([MerchantId])
REFERENCES [dbo].[Merchant_Info] ([Id])
GO
ALTER TABLE [dbo].[Merchant_AppInfo] CHECK CONSTRAINT [FK_Merchant_AppInfo_Merchant_Info]
GO
ALTER TABLE [dbo].[Merchant_AppSmsTemplate]  WITH CHECK ADD  CONSTRAINT [FK_Merchant_AppSmsTemplate_Merchant_AppInfo] FOREIGN KEY([AppId])
REFERENCES [dbo].[Merchant_AppInfo] ([Id])
GO
ALTER TABLE [dbo].[Merchant_AppSmsTemplate] CHECK CONSTRAINT [FK_Merchant_AppSmsTemplate_Merchant_AppInfo]
GO
ALTER TABLE [dbo].[Merchant_MemberBankCard]  WITH CHECK ADD  CONSTRAINT [FK_Merchant_MemberBankCard_Bank_Info] FOREIGN KEY([BankNo])
REFERENCES [dbo].[Bank_Info] ([Id])
GO
ALTER TABLE [dbo].[Merchant_MemberBankCard] CHECK CONSTRAINT [FK_Merchant_MemberBankCard_Bank_Info]
GO
ALTER TABLE [dbo].[Merchant_MemberBankCard]  WITH CHECK ADD  CONSTRAINT [FK_Merchant_MemberBankCard_Merchant_Member] FOREIGN KEY([MemberId])
REFERENCES [dbo].[Merchant_Member] ([Id])
GO
ALTER TABLE [dbo].[Merchant_MemberBankCard] CHECK CONSTRAINT [FK_Merchant_MemberBankCard_Merchant_Member]
GO
ALTER TABLE [dbo].[System_Constant]  WITH CHECK ADD  CONSTRAINT [FK_SYSTEM_C_SYSTEM_CO_SYSTEM_C] FOREIGN KEY([GroupId])
REFERENCES [dbo].[System_ConstantGroup] ([Id])
GO
ALTER TABLE [dbo].[System_Constant] CHECK CONSTRAINT [FK_SYSTEM_C_SYSTEM_CO_SYSTEM_C]
GO
ALTER TABLE [dbo].[Trade_AccountBook_Channel]  WITH CHECK ADD  CONSTRAINT [FK_TRADE_AC_TRADE_ACC_TRADE_AC] FOREIGN KEY([BookId])
REFERENCES [dbo].[Trade_AccountBook] ([Id])
GO
ALTER TABLE [dbo].[Trade_AccountBook_Channel] CHECK CONSTRAINT [FK_TRADE_AC_TRADE_ACC_TRADE_AC]
GO
ALTER TABLE [dbo].[Trade_PayApply_Channel]  WITH CHECK ADD  CONSTRAINT [FK_TRADE_PA_TRADE_PAY_TRADE_PA] FOREIGN KEY([ApplyId])
REFERENCES [dbo].[Trade_PayApply] ([Id])
GO
ALTER TABLE [dbo].[Trade_PayApply_Channel] CHECK CONSTRAINT [FK_TRADE_PA_TRADE_PAY_TRADE_PA]
GO
ALTER TABLE [dbo].[Trade_RefundBook]  WITH CHECK ADD  CONSTRAINT [FK_TRADE_RE_TRADE_REF_TRADE_AC] FOREIGN KEY([BookId])
REFERENCES [dbo].[Trade_AccountBook] ([Id])
GO
ALTER TABLE [dbo].[Trade_RefundBook] CHECK CONSTRAINT [FK_TRADE_RE_TRADE_REF_TRADE_AC]
GO
USE [master]
GO
ALTER DATABASE [GN4.Pay] SET  READ_WRITE 
GO
